package com.yy.web.pm.user.controller;

import com.yy.web.pm.user.Dto.UserLoginDto;
import com.yy.web.pm.user.Dto.UserLoginVO;
import com.yy.web.pm.user.domain.User;
import com.yy.web.pm.user.service.UserService;
import com.yy.web.pm.until.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/pm/date")
public class UserController {
    @Autowired
    private UserService usersService;




    //TODO  审核用户状态修改
    /**
     * 小程序微信授权登录
     * @param code
     * @return
     */
    @GetMapping("/auth/wechat")
    public Result<UserLoginVO> authWechat(String code) {
        UserLoginVO userLoginVO = usersService.authWechat(code);
        return Result.success(userLoginVO);
    }

 /**
  * @Title:register
  * @Description: 方法描述:小程序注册
  * @param LoginCode:
  * @param Phonecode:
  */

 @PostMapping("/register")
    public Result register(@RequestBody UserLoginDto userLoginDto) {
        return Result.success(usersService.Userregister(userLoginDto));
    }

//人员列表

    @GetMapping("/userlist")
    public Result userlist(User user) {
     return Result.success(usersService.selectAll(user));
    }
}
